// 产品角色：汽车
class Car {
    private String engine;
    private String wheels;
    private String color;

    // 构造函数，私有化以防止外部直接创建
    private Car(Builder builder) {
        this.engine = builder.engine;
        this.wheels = builder.wheels;
        this.color = builder.color;
    }

    // 产品方法
    public void assemble() {
        System.out.println("汽车组装完成：");
        System.out.println("引擎：" + engine);
        System.out.println("轮子：" + wheels);
        System.out.println("颜色：" + color);
    }

    // 构建者接口
    public static class Builder {
        private String engine;
        private String wheels;
        private String color;

        public Builder setEngine(String engine) {
            this.engine = engine;
            return this;
        }

        public Builder setWheels(String wheels) {
            this.wheels = wheels;
            return this;
        }

        public Builder setColor(String color) {
            this.color = color;
            return this;
        }

        public Car build() {
            return new Car(this);
        }
    }
}

